package com.javaoopfive;

import java.util.Objects;

public class Dog extends Pet {

    private String strain;

    public Dog(){
       super("dog",12,100);
    }

    public Dog(String strain){
        super();
        System.out.println("子类的有参构造");
        this.strain=strain;
    }

    @Override
    public void cd() {
        super.cd();
        System.out.println("吃狗粮，打维生素");
    }

    @Override
    public boolean equals(Object o) {
        if(this==o){
            return true;
        }
        if(o instanceof Dog){
            Dog dog = (Dog)o;
            if(this.getName().equals(dog.getName())){
                return true;
            }
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(strain);
    }

    @Override
    public Pet eat(String name, String eatWhy) throws RuntimeException {

        return  null;
    }

    public   void run(){

    }

    public String getStrain() {
        //this.eat();
        //eat("","");
        //super.eat("","");
        return strain;
    }

    public void setStrain(String strain) {
        this.strain = strain;
    }

}
